﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4.SequenceEqual
{
    class SequenceEqual
    {
        static void Main(string[] args)
        {
            int[] numbers = { 1, 2, 3, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 5, 5, 6, 6, 6 };
            int bestlen=1;
            int len = 0;
            int bestelement = 0;
            for (int i = 0; i < numbers.Length-1; i++)
            {

                Console.WriteLine("{0} == {1} ? - {2}",numbers[i] , numbers[i + 1], numbers[i]==numbers[i+1]);
                if (numbers[i] == numbers[i + 1])
                {
                    if (bestlen <= len)
                    {
                        bestlen+=1;
                        bestelement = numbers[i];
                    }
                    
                    len++;
                }
                else
                {
                    len = 1;
                }
            }
            Console.WriteLine(bestlen+" times- number: "+bestelement);
        }
    }
}
